 /*
 * MineralKinetics.h
 *
 *  Created on: 21 Jul 2011
 *      Author: Allan
 */

#ifndef MINERALKINETICS_H_
#define MINERALKINETICS_H_

// C++ includes
#include <string>
#include <vector>
using namespace std;

// GeoReact includes
#include "../../Reaction.h"
#include "../../Types.h"
#include "../Kinetics.h"

// GeoReact forward declarations
class Multiphase;

class MineralKinetics : public Kinetics
{
public:
	struct Catalyst;
	struct Mechanism;
	
public:
	MineralKinetics();
	
	MineralKinetics(const string& mineral, const vector<Mechanism>& mechanisms, const Reaction& reaction, const Multiphase& multiphase);
	
	virtual ~MineralKinetics();
	
	void 
	SetSpecificSurfaceArea(double specificSurfaceArea);
	
	virtual const double 
	KineticRate(double T, double P, const VectorXd& n, const VectorXd& a) const;
	
private:
	/// The mineral species
	string mineral;
	
	/// The mineral rate mechanisms of the mineral dissolution/precipitation equation
	vector<Mechanism> mechanisms;
	
	/// The mineral reaction 
	Reaction reaction;
	
	/// The index of the mineral species
	Index imineral;
	
	/// The specific surface area of the mineral
	double specificSurfaceArea;
	
public:
	struct Catalyst
	{
		/// The name of the species that participate as a catalyst in the mineral equation
		string catalystName;

		/// The index of the species that participate as a catalyst in the mineral reaction (Note: to be set up when all the species involved are known)
		Index catalystIndex;

		/// The name of the physical quantity that affects the rate of mineral dissolution/precipitation, e.g. a:activity, P:partial pressure
		string quantityName;

		/// The exponent of the quantity that affects the rate of mineral dissolution/precipitation
		double quantityExponent;
	};

	struct Mechanism
	{
		/// The name of the mechanism
		string mechanismName;
		
		/// The kinetic rate constant of the mineral reaction at 298.15 K
		double k;

		/// The Arrhenius activation energy
		double Ea;

		/// The catalysts of the reaction, e.g., a(H[+]), P(CO2(g)), a(OH[-]), a(Fe[3+]), a(Al[3+]), etc.
		vector<Catalyst> catalysts;
	};
};

#endif /* MINERALKINETICS_H_ */
